#include <iostream>
#include "LinkedList.h"

using namespace std;

// 100.00 %
class Solution
{
  public:
	void deleteNode(ListNode *node)
	{
		if (node == NULL)
			return;
		node->val = node->next->val;
		ListNode *delNode = node->next;
		node->next = delNode->next;
		delete delNode;
		return;
	}
};

int main(int argc, char const *argv[])
{
	int arr[] = {1, 2, 6, 3, 4};
	int n = sizeof(arr) / sizeof(arr[0]);
	ListNode *list = createLinkedList(arr, n);
	printLinkedList(list);
	ListNode *o = list->next->next->next;
	cout << o->val << endl;
	Solution().deleteNode(o);
	printLinkedList(list);
	deleteLinkedList(list);
	return 0;
}
